package struts.actionForm.departement;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class BeanConnexionDepartement extends ActionForm 
{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	String login=null;
	String mdp=null;
	
	public String getLogin() 
	{
		return login;
	}
	
	public void setLogin(String login) 
	{
		this.login = login;
	}
	
	public String getMdp()
	{
		return mdp;
	}
	
	public void setMdp(String mdp) 
	{
		this.mdp = mdp;
	}
	
	@Override
	public ActionErrors validate(ActionMapping mapping,	HttpServletRequest request)
	{
		ActionErrors erreurs =new ActionErrors();
		
		if ((getLogin()=="") || (getLogin()==null))
		{
			erreurs.add("Login vide", new ActionMessage("departement.erreur.loginRequis"));
		}
		else
		{		
			if ((getMdp()=="") || (getMdp()==null))
			{
				erreurs.add("Mot de passe vide", new ActionMessage("departement.erreur.mdpRequis"));
			}
		}
		
		return erreurs;
	}

}
